-
Notifications
You must be signed in to change notification settings - Fork 763
Non fxa migrated deletions #6611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non fxa migrated deletions #6611
Conversation
This migration removes user accounts that meet both criteria: 1. Have not been migrated to Firefox Accounts (is_fxa_migrated=False) 2. Have no content or content relationships (no posts, votes, messages, etc.)
7d627e8
to
698e714
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a migration to delete non-FXA migrated users who have no associated content and adds a test suite to verify the query logic.
- Adds a test case for the migration query logic in kitsune/users/tests/test_migration_0033.py
- Implements the migration in kitsune/users/migrations/0033_batch_delete_non_migrated_users.py that deletes users in batches, with logging for progress reporting
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
kitsune/users/tests/test_migration_0033.py | Introduces tests for various user content scenarios to validate deletion logic |
kitsune/users/migrations/0033_batch_delete_non_migrated_users.py | Implements batch deletion of non-migrated users with additional exclusion conditions |
Comments suppressed due to low confidence (1)
kitsune/users/migrations/0033_batch_delete_non_migrated_users.py:34
- Consider adding tests to cover the newly added exclusion conditions (locales_leader, locales_reviewer, locales_editor, and wiki_contributions) to ensure they are correctly preventing deletions when associated content exists.
| Q(locales_leader__isnull=False)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+wc
My only comment is that based on my experience with other mass deletions, a batch size of 2K seems lower than what we could safely do -- I would say we could at least do 10K -- but maybe it doesn't make much difference in the end anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+wc
| Q(wiki_contributions__isnull=False) | ||
) | ||
|
||
user_ids = list(users_to_delete.values_list("id", flat=True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will load all million + into memory. Is this a good place to use iterator
? Something like:
user_ids = users_to_delete.values_list("id", flat=True).iterator(chunk_size=2000)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is much better - that was my initial approach. The batching became more complex because of the slicing and calculating where to break out. The query will round up 800K which should be around 7MB
I am taking another shot at this - I will ping you both when it's ready |
698e714
to
d0060f4
Compare
No description provided.